const {ccclass, property} = cc._decorator;

@ccclass
export default class o1MessageBox extends cc.Component {
    @property(cc.Label)
    lbMessage: cc.Label = null;
    @property(cc.Node)
    activeNode: cc.Node = null;

    onLoad() {

    }

    start() {

    }

    //显示消息
    showMessageBox(message: string, showTime: number) {
        const height = 75;
        //
        this.lbMessage.string = message;
        //动画
        this.activeNode.y -= height;
        this.activeNode.scale = 0;
        cc.tween(this.activeNode)
            .parallel(
                cc.tween().by(0.2, {y: height}),
                cc.tween().to(0.2, {scale: 1})
            )
            .delay(showTime)
            .to(0.2, {scale: 0.1})
            .call(() => {
                this.node.destroy();
            })
            .start();
    }

    update(dt) {

    }
}
